package handler

import (
	"api/basic/global"
	__ "api/basic/proto"
	"api/internal/params"
	"github.com/gin-gonic/gin"
	"net/http"
)

func VideoDetail(c *gin.Context) {

	var req params.VideoDetailReq

	err := c.ShouldBind(&req)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 400,
			"msg":  "请求参数错误",
		})
		return
	}

	register, err := global.VideoClient.VideoDetail(c, &__.VideoDetailReq{
		Id: req.Id,
	})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{
			"code": 400,
			"msg":  err,
		})
		return
	}

	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "查询成功",
		"data": register,
	})
}
